package com.tdzx.entity;

import java.util.ArrayList;
import java.util.List;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;


import com.tdzx.util.StringUtils;

public class CompanyEntity {

	private String user_Name;
	private String user_Phone;
	private String user_Id;
	private String user_xinlang;
	
	private String listUserNews;
	
	private String user_adver;
	private String user_tx;
	
	private String noreadCount;
	private String isRead;
	
	public String getNoreadCount() {
		return noreadCount;
	}
	public void setNoreadCount(String noreadCount) {
		this.noreadCount = noreadCount;
	}
	public String getIsRead() {
		return isRead;
	}
	public void setIsRead(String isRead) {
		this.isRead = isRead;
	}
	public String getUser_Name() {
		return user_Name;
	}
	public void setUser_Name(String user_Name) {
		this.user_Name = user_Name;
	}
	public String getUser_Phone() {
		return user_Phone;
	}
	public void setUser_Phone(String user_Phone) {
		this.user_Phone = user_Phone;
	}
	public String getUser_Id() {
		return user_Id;
	}
	public void setUser_Id(String user_Id) {
		this.user_Id = user_Id;
	}
	public String getUser_xinlang() {
		return user_xinlang;
	}
	public void setUser_xinlang(String user_xinlang) {
		this.user_xinlang = user_xinlang;
	}
	public String getListUserNews() {
		return listUserNews;
	}
	public void setListUserNews(String listUserNews) {
		this.listUserNews = listUserNews;
	}
	public String getUser_adver() {
		return user_adver;
	}
	public void setUser_adver(String user_adver) {
		this.user_adver = user_adver;
	}
	public String getUser_tx() {
		return user_tx;
	}
	public void setUser_tx(String user_tx) {
		this.user_tx = user_tx;
	}
	
	public static List<CompanyEntity> getCompanyList(String json) {
		List<CompanyEntity> list = null;
		if(json != null) {
			try {
				JSONObject jo = new JSONObject(json);
				if(StringUtils.isSuccessTD(json)) {
					JSONArray resutObject = jo.optJSONArray("resutObject");
					if(resutObject != null) {
						list = new ArrayList<CompanyEntity>();
						for(int i = 0; i < resutObject.length(); i++) {
							JSONObject jo_qy = resutObject.optJSONObject(i);
							CompanyEntity ce = new CompanyEntity();
							ce.setListUserNews(jo_qy.optString("listUserNews"));
							ce.setUser_adver(jo_qy.optString("user_adver"));
							ce.setUser_Id(jo_qy.optString("user_Id"));
							ce.setUser_Name(jo_qy.optString("user_Name"));
							ce.setUser_Phone(jo_qy.optString("user_Phone"));
							ce.setUser_tx(jo_qy.optString("user_tx"));
							ce.setUser_xinlang(jo_qy.optString("user_xinlang"));
							ce.setNoreadCount(jo_qy.optString("noreadCount"));
							ce.setIsRead(jo_qy.optString("isRead"));
							list.add(ce);
						}
					}
				}
			} catch (JSONException e) {
				e.printStackTrace();
			}
		}
		return list;
	}
}
